#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 1e5 + 10;

int ans[N], a[N], n, p[N];
mt19937 rnd(19491001);

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in; rep(i, 1, n) a[i] = in;
	db st = clock();
	while((clock() - st) / CLOCKS_PER_SEC < 0.45) {
		rep(i, 1, n) p[i] = i;
		shuffle(p + 1, p + n + 1, default_random_engine(rnd()));
		int res1 = 0, res2 = 0;
		rep(i, 1, n) {
			int tr = __gcd(res1, a[p[i]]);
			if(tr != res1) res1 = tr, ans[p[i]] = 1;
			else ans[p[i]] = 2, res2 = __gcd(res2, a[p[i]]);
		} if(res1 == 1 && res2 == 1) {
			puts("YES");
			rep(i, 1, n) printf("%d ", ans[i]);
			puts(""); return 0;
		}
	} puts("NO");
	return 0;
}
